package com.example.javaweb_project.dao;

import com.example.javaweb_project.model.Employee;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.ResponseStatus;

import java.sql.Timestamp;
import java.time.LocalDate;
import java.util.List;
@Repository
public interface EmployeeDao extends JpaRepository<Employee,Long> {
    //List<employee> findByNameOrAge(String name,String age);
    @Query(value = "select * from employees where name=? or age=? or address=? or email=? or phone=? or salary=? or date=? ",nativeQuery = true)
    List<Employee> findByNameOrAgeOrAddressOrEmailOrPhoneOrDateOrSalary(String name, String age, String address, String email, Integer phone, LocalDate date, Integer salary);

    List<Employee> findByAge(Integer age);

    List<Employee> findByName(String name);

    List<Employee> findByAddress(String address);

    List<Employee> findByEmail(String email);

    List<Employee> findByPhone(Integer phone);

    List<Employee> findByDate(LocalDate date);

    List<Employee> findBySalary(Integer salary);
}

